package com.yami.shop.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.FaceDesignOrder;
import com.yami.shop.bean.param.FaceDesignOrderParam;
import com.yami.shop.common.util.PageParam;

import java.math.BigDecimal;
import java.util.List;

/**
 * 人脸设计稿订单服务接口
 * @author AI Assistant
 */
public interface FaceDesignOrderService extends IService<FaceDesignOrder> {

    /**
     * 根据用户ID分页获取订单列表
     */
    IPage<FaceDesignOrder> pageByUserId(PageParam<FaceDesignOrder> page, String userId, Integer orderStatus);

    /**
     * 根据查询参数分页获取订单列表
     */
    IPage<FaceDesignOrder> pageByOrderParam(PageParam<FaceDesignOrder> page, FaceDesignOrderParam orderParam);

    /**
     * 根据查询参数获取订单列表
     */
    List<FaceDesignOrder> listByOrderParam(FaceDesignOrderParam orderParam);

    /**
     * 根据订单编号获取订单详情
     */
    FaceDesignOrder getByOrderNumber(String orderNumber);

    /**
     * 创建订单（草稿转为设计稿后自动创建）
     */
    FaceDesignOrder createOrder(String userId, Long designId, Long draftId, BigDecimal orderAmount);

    /**
     * 创建订单（通过订单对象）
     */
    String createOrder(FaceDesignOrder order);

    /**
     * 用户申请排单
     */
    boolean applySchedule(String orderNumber, String userId);

    /**
     * 管理端确认排单
     */
    boolean confirmSchedule(String orderNumber);

    /**
     * 支付订单
     */
    boolean payOrder(String orderNumber, Integer payType, String payNo);

    /**
     * 发货
     */
    boolean shipOrder(String orderNumber, String trackingNumber, String expressCompany);

    /**
     * 确认收货
     */
    boolean confirmReceive(String orderNumber, String userId);

    /**
     * 取消订单
     */
    boolean cancelOrder(String orderNumber, String userId, String cancelReason);

    /**
     * 申请退款
     */
    boolean applyRefund(String orderNumber, String userId, String refundReason);

    /**
     * 确认退款
     */
    boolean confirmRefund(String orderNumber);

    /**
     * 根据设计稿ID获取订单
     */
    FaceDesignOrder getByDesignId(Long designId);

    /**
     * 获取用户订单统计
     */
    OrderStatistics getOrderStatistics(String userId);

    /**
     * 获取快递状态
     */
    Object getExpressStatus(String orderNumber);

    /**
     * 订单统计信息
     */
    class OrderStatistics {
        private Integer totalOrders;
        private Integer waitingPayOrders;
        private Integer waitingShipOrders;
        private Integer shippedOrders;
        private Integer completedOrders;

        // getter和setter方法
        public Integer getTotalOrders() { return totalOrders; }
        public void setTotalOrders(Integer totalOrders) { this.totalOrders = totalOrders; }
        public Integer getWaitingPayOrders() { return waitingPayOrders; }
        public void setWaitingPayOrders(Integer waitingPayOrders) { this.waitingPayOrders = waitingPayOrders; }
        public Integer getWaitingShipOrders() { return waitingShipOrders; }
        public void setWaitingShipOrders(Integer waitingShipOrders) { this.waitingShipOrders = waitingShipOrders; }
        public Integer getShippedOrders() { return shippedOrders; }
        public void setShippedOrders(Integer shippedOrders) { this.shippedOrders = shippedOrders; }
        public Integer getCompletedOrders() { return completedOrders; }
        public void setCompletedOrders(Integer completedOrders) { this.completedOrders = completedOrders; }
    }
}